{template 'header', 'member'}
<div id="head-bar">
<div class="head-bar">
<div class="head-bar-back">
<a href="{$back_link}" data-direction="reverse"><img src="{DT_MOB}static/img/icon-back.png" width="24" height="24"/><span>返回</span></a>
</div>
<div class="head-bar-title">{if $action == 'buy'}{$DT[credit_name]}购买{elseif $action == 'invite'}{$DT[credit_name]}推广{else}{$DT[credit_name]}记录{/if}</div>
<div class="head-bar-right">{if $action == 'buy' || $action == 'invite'}<a href="?action=record"><span>取消</span></a>{else}<a href="?action=buy"><span>购买</span></a>{/if}</div>
</div>
<div class="head-bar-fix"></div>
</div>
{if $action == 'buy'}
<form method="post" action="?" onsubmit="return check();" id="dform">
<input type="hidden" name="action" value="{$action}"/>
<input type="hidden" name="forward" value="{$forward}"/>
<div class="main">
<table cellpadding="6" cellspacing="6">
<tr align="center">
<td>选</td>
<td>&nbsp;&nbsp;{$DT[credit_name]}({$DT[credit_unit]})&nbsp;&nbsp;</td>
<td>&nbsp;&nbsp;{$DT[money_name]}({$DT[money_unit]})&nbsp;&nbsp;</td>
</tr>
{loop $C $k $v}
<tr align="center" onclick="Dd('type_{$k}').checked=true;k={$k};">
<td><input type="radio" name="type" id="type_{$k}" value="{$k}" {if $k==$select}checked{/if}/></td>
<td id="c_{$k}">{$v}</td>
<td class="f_red" id="p_{$k}">{$P[$k]}</td>
</tr>
{/loop}
</table>
</div>

<div class="blank-20"></div>
<div class="list-set">
	<ul>
		<li><div><span><b style="font-size:20px;color:#FF6600;" id="money">0.00</b>{$DT[money_unit]}</span>应付总额</div></li>
	</ul>
</div>

<div id="mymoney" style="display:none;">
	<div class="blank-20"></div>
	<div class="list-set">
		<ul>
			<li><div><span><b>{$_money}</b>{$DT[money_unit]}</span>账户余额</div></li>
		</ul>
	</div>
</div>

<div id="payword" style="display:none;">
	<div class="blank-20"></div>
	<div class="list-inp bd-t bd-b">
		<div><input type="password" name="password" id="password" placeholder="支付密码：" autocomplete="new-password" onblur="window.scrollTo(0,0);"/></div>
	</div>
</div>

<div id="paytype" style="display:none;">
	<div class="blank-20"></div>
	{php $PAYLIST = get_paylist();}
	<input type="hidden" name="bank" id="bank" value="{$PAYLIST[0][bank]}"/>
	<div class="list-pay">
		<ul>
		{loop $PAYLIST $k $v}
		<li onclick="var bk=$('#bank').val();if(bk=='{$v[bank]}'){return;}$('#check-'+bk).attr('class', 'check');$('#check-{$v[bank]}').attr('class', 'checked');$('#bank').val('{$v[bank]}');"><div><em class="{if $k}check{else}checked{/if}" id="check-{$v[bank]}"></em><img src="{DT_PATH}api/pay/{$v[bank]}/icon.png" width="24" height="24"/>{$v[name]} {if $v[percent]>0}<span>手续费 {$v[percent]}%</span>{/if}</div></li>
		{/loop}
		</ul>
	</div>
</div>

<div class="blank-20"></div>
<div class="list-btn"><input type="submit" name="submit" value="立即购买" class="btn-green"/></div>
<div class="blank-20"></div>
</form>
{elseif $action == 'invite'}
<div class="main content">
<b>推广网址</b><br/>
网站首页：<a href="javascript:prompt('长按网址可以复制', '{$url}');" class="b">复制网址</a><br/>
会员注册：<a href="javascript:prompt('长按网址可以复制', '{$url}&goto=register');" class="b">复制网址</a><br/>
我的主页：<a href="javascript:prompt('长按网址可以复制', '{$url}&goto=homepage');" class="b">复制网址</a><br/>
<br/>
<b>推广方法</b><br/>
- 将上面的网址发给您QQ/微信/Email等好友<br/>
- 在论坛签名,博客链接,网站等加上上面的网址<br/>
<br/>
<b>奖励规则</b><br/>
- 每引导一个IP访问您可以获赠 <strong class="f_blue">{$MOD[credit_ip]}</strong> {$DT[credit_name]} (24小时内最多积{$MOD[credit_maxip]}{$DT[credit_name]})<br/>
- 每引导一个用户注册您可以获赠 <strong class="f_blue">{$MOD[credit_user]}</strong> {$DT[credit_name]}<br/>
<br/>
<b>备注事项</b><br/>
- 无论引导至那个页面，系统均会自动记录您为用户注册推荐人<br/>
- 引导用户需注册成功完善资料后方可为您加分<br/>
- 同一IP 24小时内计算一次<br/>
<br/>
<b>推广记录</b><br/>
<a href="?kw={urlencode('推广')}" class="b">点击查看</a>
<br/><br/><br/>
</div>
{else}
{if $lists}
{loop $lists $v}
<div class="list-img">
<ul>
<li>
<span class="f_r">余额:{$v[balance]}</span>
{if $v[amount] < 0}
<strong style="font-size:24px;color:#FF6600;">{$v[amount]}</strong>
{else}
<strong style="font-size:24px;">+{$v[amount]}</strong>
{/if}
</li>
<li><span class="f_r">{$v[addtime]}</span><span>{$v[reason]}</span></li>
</ul>
</div>
{/loop}
{/if}
{if $pages}<div class="pages">{$pages}</div>{/if}
{/if}
{if $action == 'buy'}
<script type="text/javascript">
var k = {$select};
function check() {
	var money = $('#p_'+k).html();
	if(money > {$_money}) {
		Go('charge.php?action=pay&reason=credit|'+k+'&amount='+money+'&bank='+$('#bank').val());
		return false;
	}
	if(money > {$DT[quick_pay]}){
		if(Dd('password').value.length < 6) {
			Dmsg('请填写支付密码', 'password');
			return false;
		}
	}
	return true;
}
window.setInterval(
	function() {
		var money = $('#p_'+k).html();
		$('#money').html(money);
		if(money > {$_money} || {$_money} < 0.01) {
			$('#mymoney').hide();$('#paytype').show();$('#payword').hide();
		} else {
			$('#mymoney').show();$('#paytype').hide();if(money > {$DT[quick_pay]}){$('#payword').show();}
		}
	}, 
500);
</script>
{/if}
{template 'footer', 'member'}